#pragma once
#include <initializer_list>
#include <iostream>
using namespace std;

template<class T>
class Vector
{
public:
	Vector()
		:_start(nullptr)
		,_finish(nullptr)
		,_endofstorage(nullptr)
	{}

	Vector(initializer_list<T> l)
	{
		_start = new T[l.size()];
		_finish = _start + l.size();
		_endofstorage = _start + l.size();

		int i = 0;
		for (auto e : l)
		{
			_start[i++] = e;
		}
	}

	Vector<T>& operator=(initializer_list<T> l)
	{
		delete _start;
		_start = new T[l.size()];
		_finish = _start + l.size();
		_endofstorage = _start + l.size();
		
		int i = 0;
		for (auto e: l)
		{
			_start[i++] = e;
		}
		return *this;
	}

	~Vector()
	{
		delete _start;
		_start = _finish = _endofstorage = nullptr;
	}
private:
	T* _start;
	T* _finish;
	T* _endofstorage;
};

void test()
{
	Vector<int> v{ 1, 2, 3, 4 };
	Vector<int> v1;
	v1 = v;
}